#!/usr/bin/env bash
# Run one of the samples.
# The first argument must be the name of the sample task (e.g. echo).
# Any remaining arguments are forwarded to the sample's argv.

task=$1
shift 1

if [ -z "${task}" ] || [ ! -d "samples/${task}" ]
then
    echo "Unknown sample: '${task}'"
    exit 1
fi

./gradlew --quiet ":samples:${task}:installDist" && "./samples/${task}/build/install/${task}/bin/${task}" "$@"
